const router = require('koa-router')();
const { 
    resBody
} = require("../../utils")
const { models, sequelize } = require('../../utils/db');

// 省市区
router.post('/', async(ctx, next) => {
    const {
        levelType = 1,
        parentId = ''
    } = ctx.request.body;
    let whereCase = {
        level_type: levelType
    };
    parentId ? whereCase.parent_id = parentId : '';
    let citys = await models.citys_model.findAll({
        raw: true,
        where: whereCase
    });
    ctx.body = {
        ...resBody.success,
        data: citys
    };
});
module.exports = router
